package com.ykdl.member.kid.marketcard;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import com.ykdl.member.base.GlobalContext;
import com.ykdl.member.constant.KidAction;
import com.ykdl.member.constant.KidConfig;
import com.ykdl.member.kid.R;
import com.ykdl.member.kid.gears.WebViewActivity;
import com.ykdl.member.kid.util.AccessTokenKeeper;
import com.ykdl.member.kid.util.ShareUtil;
import com.ykdl.member.kid.widget.dialog.DialogCallBack;
import com.ykdl.member.kid.widget.dialog.DialogImpl;
import com.ykdl.member.kid.widget.dialog.IDialog;

public class CardScoreWapActivity extends WebViewActivity {
	String url = null;
	String log_url = null;
	private String point_type_id;
	private  AccessTokenKeeper mTokenKeeper;
	private int URL_TYPE ;
	private boolean isshow=false;
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		if (isshow) {
	       	 goneButton();
	       	setIsfirst(false);
			}
	}
	@Override
	protected void getIntentData() {
		// TODO Auto-generated method stub
		URL_TYPE = this.getIntent().getIntExtra(KidAction.URL_TYPE, 9999);
		mTokenKeeper = new AccessTokenKeeper(GlobalContext.mContext);
		point_type_id = this.getIntent().getStringExtra(KidAction.POINT_TYPE_ID);
		switch (URL_TYPE) {
		case 0:
			url=KidConfig.EXCHANGE_LIST+mTokenKeeper.getmAccessTokenTitle()+"="+mTokenKeeper.getmAccessToken()+"&point_type_id="+point_type_id;
			log_url=KidConfig.EXCHANGE_LOG+mTokenKeeper.getmAccessTokenTitle()+"="+mTokenKeeper.getmAccessToken()+"&point_type_id="+point_type_id;
			break;
		case 2:
			url=KidConfig.LOTTERY_LIST+mTokenKeeper.getmAccessTokenTitle()+"="+mTokenKeeper.getmAccessToken()+"&point_type_id="+point_type_id;
			log_url=KidConfig.LOTTERY_LOG+mTokenKeeper.getmAccessTokenTitle()+"="+mTokenKeeper.getmAccessToken()+"&point_type_id="+point_type_id;
			break;
		case 3:
			url=KidConfig.CHARITABLE_LIST+mTokenKeeper.getmAccessTokenTitle()+"="+mTokenKeeper.getmAccessToken()+"&point_type_id="+point_type_id;
			log_url=KidConfig.CHARITABLE_LOG+mTokenKeeper.getmAccessTokenTitle()+"="+mTokenKeeper.getmAccessToken()+"&point_type_id="+point_type_id;
			break;
		case 4:
			isshow=true;
			url=KidConfig.POINTS_LOG+mTokenKeeper.getmAccessTokenTitle()+"="+mTokenKeeper.getmAccessToken()+"&point_type_id="+point_type_id;
			break;
		/*case 4:
//			url=KidConfig.EXCHANGE_LIST;
			break;*/
		default:
			break;
		}
		
	}
	
	@Override
	protected void setWapTitle() {
		// TODO Auto-generated method stub
	        setRightbt(R.drawable.log_ic_bt,new OnClickListener() {

				@Override
				public void onClick(View v) {
					webView.loadUrl(log_url);
				}
			});
	}

	@Override
	protected void startLoadUrl() {
		// TODO Auto-generated method stub
		webView.loadUrl(url);
	}

	@Override
	protected boolean overrideUrlLoading(WebView view, String url) {
		// TODO Auto-generated method stub
		String mUrl = url;
		return false;
	}

}
